<{script src="goodseditor.js" app="business" pdir="js"}>
<{script src="uploader.js" app="business" pdir="js"}>
<{script src="modedialog.js" app="business" pdir="js"}>
<script>
  window.addEvent('domready',function(){
    goodsEditFrame({'path':'<{$current_url}>/uploader.swf','IMAGE_MAX_SIZE':'<{$IMAGE_MAX_SIZE}>','url':'<{link app=business ctl=site_mimages act=gimage_swf_remote arg=$store_id}>','imgsize':'<{$img_size}>'});
  });
</script>
<div id="main" class="member-main" action="">
  <form method="post" action="<{link app=business ctl='site_member' full='1' act='toAdd'}> " id='form_saveGoods' class="section">
  <div id="gEditor-Body">
  <div class="title "><{t}>编辑宝贝<{/t}></div>
    <div class="title_fb"><{t}>1. 宝贝基本信息<{/t}></div>
    <div class="FormWrap" style="background:none">
      <input id="gEditor-GId-input" type="hidden" value="<{$goods.goods_id}>" name="goods[goods_id]">
      <input type="hidden" name="productkey" value="<{$productkey}>"/>
      <input type="hidden" name="goods_switch" value="<{$goods_switch}>"/>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="liststyle data" style="border:none">
        
        <col class="span-3 bg-gray"/>
        <col class="span-auto"/>
        <tbody>
        <{if false}>
        <tr>
          <th><{t}>宝贝新旧：<{/t}></th>
          <td>
            <input type="radio" name="goods[goods_state]"<{if $goods.goods_state != 'used' }> checked="checked"<{/if}> value="new" ><{t}>全新<{/t}>
            <input type="radio" name="goods[goods_state]"<{if $goods.goods_state == "used"}> checked="checked"<{/if}> value="used" ><{t}>二手<{/t}>
          </td>
        </tr>
        <{/if}>
        <input type="hidden" name="goods[goods_state]" value="new" >
        <tr>
          <th><em><font color="red">*</font></em><{t}>宝贝分类：<{/t}></th>
          <td>
            <{input type="vg2cat" value="{$goods.category.cat_id}" name="goods[category][cat_id]"}>
          </td>
        </tr>
        <tr style="display:none;">
          <th><{t}>宝贝类型：<{/t}></th>
          <td>
            <select name="goods[type][type_id]" id="gEditor-GType-input" readyonly=readyonly>
              <!--<option value='1'><{t}>通用商品类型<{/t}></option>-->
              <{foreach from=$gtype item=type}>
                <option class="optionlevels" value='<{$type.type_id}>' <{if $type.type_id==$goods.type.type_id}>selected<{/if}>><{$type.name}>
                </option>
              <{/foreach}>
            </select>
          </td>
        </tr>
        <tr>
          <th><em><font color="red">*</font></em><{t}>商品名称：<{/t}></th>
          <td><{input type="text" id="id_gname" name="goods[name]" required="true" maxlength="100" vtype='required' value=$goods.name style="width:60%"}></td>
        </tr>
        <tr>
          <th><{t}><{/t}></th>
          <td></td>
        </tr>
        <{if $goodsbn_display_switch}>
          <tr>
            <th><{t}>商品编号：<{/t}></th>
            <td><{input type="text" name="goods[bn]" value=$goods.bn }></td>
          </tr>
        <{else}>
          <input type='hidden' name="goods[bn]" value="<{$goods.bn}>">
        <{/if}>
        <tr>
          <th><{t}>商品关键词：<{/t}></th>
          <td>
            <{foreach from=$goods.keywords item=keywords}><{assign var='keyword' value="{$keyword}|{$keywords.keyword}"}><{/foreach}>
            <input type="text" name="keywords" value="<{$keyword|trim:'|'}>" class="inputstyle" maxlength="100"/>
            <span class="notice-inline "><{t}>用于筛选商品，多个关键词用半角竖线"|"分开<{/t}></span>
          </td>
        </tr>
            
        <tr>
          <th><{t}>商品简介：<{/t}></th>
          <td>
            <{input type="textarea" class="x-input" value=$goods.brief name="goods[brief]" style="resize:none;" cols="50" rows="5" maxth="255" }>
            <div class="notice-inline"><{t}>简短的商品介绍,请不要超过70个字<{/t}></div>
          </td>
        </tr>
        <{if false}>
        <tr>
          <th><{t}>模板：<{/t}></th>
          <td><{template_filter type="product" class="inputstyle" selected=$goods.goods_setting.goods_template name="goods[goods_setting][goods_template]"}></td>
        </tr>
        <{/if}>
        <tr>
          <th><{t}>商品权值：<{/t}></th>
          <td><span><{$goods.goods_order_down}>%</span></td>
        </tr>
        <tr>
          <th><{t}>商品相册：<{/t}></th>
          <td>
            <div class="division pic-main" style="margin:0;position:relative">
              <div class="clearfix">
                <span class="pic-uploader">
                  <{button app="desktop" class="btn-upload" label=$___b2c="添加商品图片"|t:'b2c' icon="image_new.gif"}>
                </span>
                <{help}><{t}>提示：上传图片需为<{$img_size}>以上正方形图片，大小不能超过1M<{/t}><{/help}>
              </div>
              <div class="pic-area">
                <input type="hidden" name="image_default" value="<{$goods.image_default_id}>" />
                <{include file="site/goods/gimage_goods.html" app="business"}>
              </div>
            </div>
          </td>
        </tr>
        
        </tbody>
      </table>

          <div id="gEditor-ginfo">
          <{include file="site/goods/ginfo.html" app="business"}>
          </div>
        </tr>
    </div>
    <div class="FormWrap" style="background:none">
      <table border="0" cellpadding="0" cellspacing="0" class="liststyle tdright" style="border:none">
        <tr>
          <th ><{t}>运费模板：<{/t}></th>
          <td>
            <{input type="vobject" object="dlytype" filter=$gdlytype_filter multiple="true" rowselect="true" textcol="dt_name" name="gdlytype" value=$goods.gdlytype}>
          </td>
        </tr>
        <tr>
          <th ><{t}>是否包邮：<{/t}></th>
          <td>
            <input type="radio" name="goods[freight_bear]"<{if $goods.freight_bear != 'business' }> checked="checked"<{/if}> value="member" ><{t}>否<{/t}>
            <input type="radio" name="goods[freight_bear]"<{if $goods.freight_bear == "business"}> checked="checked"<{/if}> value="business" ><{t}>是<{/t}>
          </td>
        </tr>
        <!--tag_foreign_freeshipping-->
        <{if $site_min_order == 'true'}>
        <tr>
          <th><{t}>起定量：<{/t}></th>
          <td><{input type="unsigned" value=$goods.min_buy name="goods[min_buy]" style="width:60px" maxlength="25" }></td>
        </tr>
        <{/if}>
        <{if $goods.type.is_physical}>
        <tr>
          <th><{t}>计量单位：<{/t}></th>
          <td><{input type="text" value=$goods.unit name="goods[unit]" maxlength="25" style="width:60px"}></td>
        </tr>
        <{/if}>
        <tr>
          <th><{t}>立即上架：<{/t}></th>
          <td>
            <input type="radio" name="goods[status]"<{if $goods.status != 'false' }> checked="checked"<{/if}> value="true" <{if $goods.marketable_allow != 'true'}>disabled="true"<{/if}>><{t}>是<{/t}>
            <input type="radio" name="goods[status]"<{if $goods.status == "false"}> checked="checked"<{/if}> value="false" <{if $goods.marketable_allow != 'true'}>disabled="true"<{/if}>><{t}>否<{/t}>
          </td>
        </tr>
        <{if false}>
        <tr>
          <th><{t}>无库存也可销售：<{/t}></th>
          <td>
            <input type="radio"  name="goods[nostore_sell]"<{if $goods.nostore_sell eq 1 }> checked="checked"<{/if}> value="1" ><{t}>是<{/t}>
            <input type="radio"  name="goods[nostore_sell]"<{if $goods.nostore_sell eq 0}> checked="checked"<{/if}> value="0" ><{t}>否<{/t}>
          </td>
        </tr>
        <{/if}>
        <{if $env.conf.b2c.site.get_policy.method ==3}>
        <tr>
          <th><{t}>积分：<{/t}></th>
          <td>
            <{input type="digits" value=$goods.gain_score|default:$point_mim_get_value name="goods[gain_score]" maxlength="25" vtype="score" id="gain_score"}>%
            <input type='hidden' name='goods[score_setting]' value='percent'/>
            <span>（请填写与商品销售价的比例，运营商设置范围为<{$point_mim_get_value}>%~<{$point_max_get_value}>%）</span>
          </td>
        </tr>
        <{/if}>
        <tr>
          <th><{t}>自定义分类：<{/t}></th>
          <td>
            <{input type="vobject" object="goods_cat@business" filter=$catlink_filter multiple="true" rowselect="true" textcol="cat_name" name="customcatid" value=$goods.customcat}>
          </td>
        </tr>
      </table>
    </div>
  </div>
  <div>
    <div class="title_fb"><{t}>2. 配件<{/t}></div>
    <div class="tableform">
      <{button label=$___b2c="添加配件"|t:'b2c' type="button" onclick="goodsEditor.adj.addGrp.bind(goodsEditor)('goods-adj')" icon="btn_add.gif"}>
      <div class="adjs" id="goods-adj">
      <{foreach from=$goods.adjunct item=adjunct key=key}>
      <{if $adjunct.type}>
      <{include file="site/goods/adj_row.html" app="business"}>
      <{/if}>
      <{/foreach}>
    </div>
  </div>
  <div>
    <div class="title_fb"><{t}>3. <em><font color="red">*</font></em>详细介绍<{/t}></div>
    <div class="tableform">
    <{input type="vhtml" name="goods[description]" value=$goods.description includeBase=true}>
    </div>
  </div>
  <div>
    <div class="title_fb"><{t}>4. 相关商品<{/t}></div>
    <div class="tableform">
    <{input type="vobject" object="goods" return_url="{$return_url}" filter=$goodslink_filter multiple="true" rowselect="true"  textcol="name" name="linkid" value=$goods.glink.items view="b2c:admin/goods/detail/rel_items.html"}>
    </div>
  </div>
  <div>
    <div class="title_fb"><{t}>5. SEO设置<{/t}></div>
      <{assign var=seo_info value=$goods.seo_info}>
      <div class="tableform" >
       <table border="0" cellpadding="0" cellspacing="0" class="liststyle tdright">
       <!-- <tr>
          <th >Page Title</th>
          <td><input type='text' class="inputstyle" name='goods[seo_info][seo_title]' value='<{$seo_info.seo_title}>'/></td>
       </tr> -->
       <tr>
          <th>Meta Keyword</th>
          <td><input type='text' class="inputstyle" name='goods[seo_info][seo_keywords]' value='<{$seo_info.seo_keywords}>'/></td>
       </tr>
        <tr>
          <th>Meta Description</th>
          <td><input type='text' class="inputstyle" name='goods[seo_info][seo_description]' value='<{$seo_info.seo_description}>'/></td>
       </tr>
        <!-- <tr>
          <th><{t}>自定义url<{/t}></th>
          <td><input type='text'class="inputstyle" name='goods_static' value='<{$goods_static}>'/></td>
       </tr> -->
       </table>
    </div>
  </div>
  <div style="padding-left:142px; margin-top:10px"><{button class="submit-btn" type="submit" label=$___b2c="保存"|t:'b2c' onclick="subsub()" rel="_request"}></div>
</div>            

<script>
validatorMap['score']= ['<{t}>积分填写不正确<{/t}>', function() {
    var gain_score = $('gain_score');
    var _is_validate = false;
			if (gain_score.value >= <{$point_mim_get_value}> && gain_score.value <= <{$point_max_get_value}>) _is_validate = true||_is_validate;
    return _is_validate;
  }];
var subsub = function(){
  $ES('textarea[ishtml=true]', '#gEditor-Body').getValue();
  if($('product_datas'))$('product_datas').getValue();
}
</script>